package Test07;

//多线程常用方法

/*
setPriority(int newPriority)设置线程的优先级
final int getPriority()获取线程的优先级
 */
public class Test05 {
    public static void main(String[] args) {

        //创建线程要执行的参数对象
        MyRunnable05 mr = new MyRunnable05();

        //创建线程对象
        Thread t1 = new Thread(mr,"飞机");
        Thread t2 = new Thread(mr,"坦克");

        //设置优先级
        t1.setPriority(1);
        t2.setPriority(10);

        //启动线程
        t1.start();
        t2.start();
    }
}

class MyRunnable05 implements Runnable {

    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(Thread.currentThread().getName() + "---" + i);
        }
    }
}
